home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1996 #15
/
Monster Media Number 15 (Monster Media)(July 1996).ISO
/
prog_c
/
cuj0696.zip
/
DWYER.ZIP
/
RUN.TST
/
README.RUN
< prev
next >
Wrap
Text File
|
1996-01-10
|
3KB
|
58 lines
DESCRIPTION OF THE RUN TEST
Introduction
------------
This implementation of the run test is concerned with "runs up" -
monotone increasing sequences of distinct variates. Instead of
implementing the "horribly complicated method" [K1, p. 74] of
Knuth's first test, we opted for the "vastly simpler and more
practical run test" [K1, p. 65]. The algorithms used by our
gap test are described in exercises 12 and 14 of Knuth, page 74,
and the answers on page 536. The algorithm that determines the
length of the runs is implemented in cntruns.c. The function
that generates the set of distinct variates is genrunda.c.
The run test counts lengths of monotone increasing subsequences
(runs up) of an original sequence of distinct variates. Runs up
of lengths one to five are counted separately. Runs with lengths
six or higher are lumped together. The probabilities for the run
lengths and expected counts for 3600 runs are:
Run Probability Expected Count
--- ----------- --------------
1 1/2 1800
2 1/3 1200
3 1/8 450
4 1/30 120
5 1/144 25
6 (+) 1/720 5
To get 3600 runs, which, as you can see, yields an expected count of
five for the least likely run length, about 10,000 distinct variates
must be generated. To get that many distinct variates about 11931
samples from the uniform generator are required. This is the mean
number required and it comes with a standard deviation of about 49.5.
To keep the program from "getting stuck" while looking for a complete
set of 10,000 an upper range of 12426 variates is set. This is the
mean plus 10 standard deviations. The mean and standard deviation are
calculated in runmnsd.c using formulas from Knuth, page 74, exercise
10.
The run test is implemented as program runtst.exe. This program
performs a Kolmogorov-Smirnov analysis on probabilities from 100
chi-square tests. The chi-square statistics are calculated in
genchisq.c; corresponding probabilities are calculated via calls
to library function chdtr() which is called in the main rpogram,
runtst.c. Function KSCalc() is called in main() to calculate
Kolmogorov-Smirnov statistics and probabilities. The parameters
that you specify to execute the run test are:
seed for random number generator
name of random number generator
minimum number of events per category (there are six)
These parameters are read from the console unless you redirect
the input device. As usual, prompts and messages are written
to stderr and results are written to stdout.